package com.ll.wrapperdemo;

/**
 * @author 刘龙
 * @version 1.0
 */
public class IntegertDemo {
    public static void main(String[] args) {
        Integer i = new Integer(1);
        Integer j = new Integer(1);
        // false
        System.out.println(i == j);


        /**
         *     @HotSpotIntrinsicCandidate
         *     public static Integer valueOf(int i) {
         *                      -128                        127
         *         if (i >= IntegerCache.low && i <= IntegerCache.high)
         *             return IntegerCache.cache[i + (-IntegerCache.low)];
         *         return new Integer(i);
         *     }
         */
        // 底层 Integer.valueOf(1)
        Integer m = 1;
        Integer n = 1;
        // true
        System.out.println(m == n);

        Integer x = 128;
        Integer y = 128;
        // false
        System.out.println(x == y);
    }
}
